﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Rendering;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using PlatformNetCore.Entity;
using PlatformNetCore.Entity.Models;

namespace PlatformNetCore.IService
{
    public interface ISysService
    {
        #region 用户管理
        /// <summary>
        /// 获取
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        SysUser GetSysUser(string id);
        /// <summary>
        /// 登录
        /// </summary>
        /// <returns></returns>
        SysUser GetSysUser(string userName, string pwd);
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="entity"></param>
        ResultResponse AddSysUser(SysUser entity);
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="entity"></param>
        ResultResponse UpdateSysUser(SysUser entity);
        /// <summary>
        /// 启用，停用 操作
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="dateStatus"></param>
        /// <returns></returns>
        ResultResponse UpdateSysUserState(List<string> ids, string userName, DataStatus dataStatus);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        ResultResponse DeleteSysUser(string id);
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        LayPager<SysUser> GetSysUserPagedList(int pageIndex, int pageSize, string search);
        #endregion

        #region 角色管理
        /// <summary>
        /// 获取角色
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        SysRole GetSysRole(string id);
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="entity"></param>
        ResultResponse AddSysRole(SysRole entity);
        /// <summary>
        /// 获取权限树
        /// </summary>
        /// <param name="id"></param>
        /// <param name="spread"></param>
        /// <returns></returns>
        List<Dynatree> GetRoleRightsTree(string id);
        /// <summary>
        /// 角色权限设置
        /// </summary>
        /// <param name="model"></param>
        /// <param name="cuser"></param>
        /// <returns></returns>
        ResultResponse<bool> RoleSetup(SettingRequest model, CurrentUser cuser);
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="entity"></param>
        ResultResponse UpdateSysRole(SysRole entity);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        ResultResponse DeleteSysRole(string id);
        /// <summary>
        /// 获取角色所有数据
        /// </summary>
        /// <returns></returns>
        IEnumerable<SysRole> GetSysRoleList();
        /// <summary>
        /// 获取当前登录用户的角色列表
        /// </summary>
        /// <returns></returns>
        IEnumerable<SelectListItem> GetSysRoleListDLL();
        /// <summary>
        /// 获取角色分页数据
        /// </summary>
        /// <returns></returns>
        LayPager<SysRole> GetSysRolePagedList(int pageIndex, int pageSize);
        /// <summary>
        /// 角色下来列表
        /// </summary>
        /// <param name="croleId"></param>
        /// <returns></returns>
        List<SelectListItem> GetSysRoleDLL(string roleId);
        #endregion

        #region 权限管理
        /// <summary>
        /// 获取 权限列表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        List<SysRight> GetSysRightListByRoleId(string roleId, Expression<Func<SysRight, bool>> other = null);
        /// <summary>
        /// 获取 权限列表
        /// </summary>
        IList<SysRight> GetSysRightList();
        /// <summary>
        /// 获取
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        SysRight GetSysRight(string id);
        /// <summary>
        /// 遍历得到所有节点id
        /// </summary>
        /// <param name="list"></param>
        /// <param name="rightIds"></param>
        /// <returns></returns>
        List<string> GetRightIds(List<Dynatree> list, ref List<string> rightIds);
        /// <summary>
        /// 操作类型
        /// </summary>
        /// <param name="ParentID"></param>
        /// <param name="isInclude"></param>
        /// <param name="isValue"></param>
        /// <param name="otherItem"></param>
        /// <returns></returns>
        List<SelectListItem> GetSysDictCodeDLL(string ParentID, bool isInclude = false, bool isValue = false, SelectListItem otherItem = null);
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="entity"></param>
        ResultResponse AddSysRight(SysRight entity);
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="entity"></param>
        ResultResponse UpdateSysRight(SysRight entity);
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="id"></param>
        ResultResponse DeleteSysRight(string id);
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        IEnumerable<SysRight> GetAllSysRightList();
        #endregion

        #region 登录管理
        /// <summary>
        /// 登录操作
        /// </summary>
        /// <param name="http"></param>
        /// <param name="username"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>
        ResultResponse<CurrentUser> SignIn(HttpContext httpContext, string username, string password, string vercode);
        /// <summary>
        /// 获取当前用户新
        /// </summary>
        /// <returns></returns>
        CurrentUser GetCurrentUser(HttpContext httpContext, string authenticationScheme);
        #endregion
        
    }
}
